#ifndef CAMERA_H
#define CAMERA_H
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "Object.h"

namespace renderengine
{
    struct Frustum {
        Frustum() {
            m_left = -1.0f;
            m_right = 1.0f;
            m_bottom = -1.0f;
            m_top = 1.0f;
            m_near = 0.001f;
            m_far = 1000.0f;
        }
        Frustum(float frustum[6]) {
            m_left = frustum[0];
            m_right = frustum[1];
            m_bottom = frustum[2];
            m_top = frustum[3];
            m_near = frustum[4];
            m_far = frustum[5];
        }
        Frustum(float _left,
            float _right,
            float _bottom,
            float _top,
            float _near,
            float _far) {
            m_left = _left;
            m_right = _right;
            m_bottom = _bottom;
            m_top = _top;
            m_near = _near;
            m_far = _far;
        }
        float m_left;
        float m_right;
        float m_bottom;
        float m_top;
        float m_near;
        float m_far;
    };
    class Camera :public Object
    {
    public:
        enum PROJECTION_TYPE
        {
            PRESPECTIVE,
            PARALLEL
        };

        Camera();
        ~Camera();

        void LookAt(glm::vec3 eye, glm::vec3 point, glm::vec3 up);
        glm::mat4 getViewMatrix() const;
        void setViewMatrix(glm::mat4 _viewMatrix);

        glm::mat4 getProjectionMatrix() const;
        void setProjectionMatrix(glm::mat4 _projectionMatrix);
        void setFrustum(Frustum _frustum);
        void setProjectionType(PROJECTION_TYPE _type);

        glm::vec3 getPosition();
        glm::vec3 getEye();
        glm::vec3 getUp();
    private:
        glm::mat4 m_ViewMatrix;
        glm::mat4 m_ProjectionMatrix;
        PROJECTION_TYPE m_projType;
        Frustum m_Frustum;
        glm::vec3 m_eye;
        glm::vec3 m_pos;
        glm::vec3 m_up;

    };
}
#endif // !CAMERA_H
